Ext.namespace('GBIF');
Ext.namespace('GBIF.GeoSpatial');

GBIF.GeoSpatial.AvailableLayersTree = function(config){

	Ext.apply(this,config,{
			useArrows: false
		,	border: true
		,	rootVisible: false
		,	height:350
		,	width:400
		,	root: new Ext.tree.AsyncTreeNode({
					text: 'Layers'
				,	draggable: false
				,	expanded:true
				,	children:[{
									text:'Child'
        	    	    	    ,	allowDrag:false
								,	leaf:true
						}]
			})
		,	tbar:[{
           			text: 'New Folder'
				,	scope:this	
            	,	handler: function(){
						var root = this.getRootNode();
                		var node = root.appendChild(new Ext.tree.TreeNode({
		            	        	text:'Dummy'
        	    	    	    ,	allowDrag:false
								,	leaf:false
                			}));
						 var ge = new Ext.tree.TreeEditor(this, { }, {
								        allowBlank:false,
								        blankText:'A name is required',
								        selectOnFocus:true
						    });
						this.getSelectionModel().select(node);
                		setTimeout(function(){
		                	    ge.editNode = node;
        		            	ge.startEdit(node.ui.textNode);
                			}, 10);
            		}
        	}]	
	});

	GBIF.GeoSpatial.AvailableLayersTree.superclass.constructor.call(this, config);
}

Ext.extend(GBIF.GeoSpatial.AvailableLayersTree, Ext.tree.TreePanel, {
		
});